package com.example.a14874.intent_explicit_implicit_call;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class MainActivity extends AppCompatActivity {
    private Button btnOpenB;
    private Button btnMap;
    private static String MY_ACTION="com.view.my_ACtion";
    @Override
    protected void onCreate( Bundle savedInstanceState ) {
        super.onCreate( savedInstanceState );
        setContentView( R.layout.activity_main );
        btnOpenB =findViewById( R.id.OpenB );
        btnOpenB.setOnClickListener( new View.OnClickListener() {
            @Override
            public void onClick( View v ) {
                Intent intent= new Intent(  );
                intent.setAction( "com.android.activity" );
                intent.putExtra("KEY","VALUE");
                intent.setClass( MainActivity.this,ActivityB.class );
                startActivity( intent );
            }
        } );
    btnMap =findViewById( R.id.btn_open_map );
    btnMap.setOnClickListener( new View.OnClickListener() {
        @Override
        public void onClick( View v ) {
            Intent intent = new Intent(  );
            intent.setAction(MY_ACTION );
            startActivity( intent );
        }
    } );
    }
}
